<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/common/taglibs.jsp"%>
<script type="text/javascript" src="${ctx}/scripts/space.js"></script>
<link rel="stylesheet" type="text/css" href="${ctx}/styles/show.css" media="screen"/>
<div class="show_left">
<div class="show_tit">
	<div class="show_tit_fun"><span>快来结交新朋友</span></div>
	<span>共有<font style="color:red"><strong>${page.totalCount}</strong></font>人符合您的搜索条件条件</span>
</div>
<div id="show" class="show">
	<c:if test="${page.totalCount > 0}">
		<c:forEach var="user" items="${page.items}"  varStatus="status">
			<div class="show_item">
				<div class="show_user_avatar">
					<a href="<c:url value='/space/index.do?usr=${user.userid}'/>" target="_blank">
					<img class="show_user_avatar_img" alt="我的头像" src="${ctx}/${user.avatar}"/>
					</a>
				</div>
				<div class="show_user_info_nickname">
					<span>
					<ms:user type="nickname" userid="${user.userid}" nickname="${user.nickname}" style="a2">
					</ms:user>
					</span>
				</div>
				<div class="show_user_info_other">
					<c:if test="${user.gender == 0}"><fmt:message key="common.gender.unknow" /></c:if>
					<c:if test="${user.gender == 1}"><fmt:message key="common.gender.male" /></c:if>
					<c:if test="${user.gender == 2}"><fmt:message key="common.gender.female" /></c:if>
					/${user.age}岁/<span id="user_vote_count_${user.userid}" style="color:red;">${user.travelVoteCount}</span>支持
				</div>
				<div class="show_user_info_fun">
					<c:if test="${user.userid != userid}">
						<c:set var="roster_relation"><ms:roster sender="${userid}" receiver="${user.userid}"/></c:set>
						<c:if test="${roster_relation==0 || roster_relation==3}">
							<button onclick="requestFriend(${user.userid});">加为好友</button>
						</c:if>
						<button onclick="voteTravel(${user.userid});">支持</button>
					</c:if>
				</div>
			</div>
		</c:forEach>
	</c:if>
	<c:if test="${page.totalCount == 0}">
	无符合条件用户
	</c:if>
	<div style="float:left;overflow:hidden;width:100%">
	<jsp:include page="/common/pager.jsp" />
	</div>
</div>
</div>
<div id="show_search" class="show_search">
	<div class="show_search_part">
		<div class="dirbar"><span>快速查找</span></div>
		<form id="f_show_search" action="<c:url value="/show/search.do"/>" method="post"/>
			<input type="hidden" name="searchType" value="1">
			<table cellpadding="5px" cellspacing="0">
				<tr>
					<td>
					昵称：<input type="text" name="searchNick" value="${searchNick}">
					</td>
				</tr>
				<tr>
					<td>
					<input type="submit" name="搜索" value="搜索">
					</td>
				</tr>
			</table>
		</form>
	</div>
	<div class="clears"></div>
	<div class="show_search_part">
		<div class="dirbar"><span>找朋友</span></div>
		<form id="f_show_search" action="<c:url value="/show/search.do"/>" method="post"/>
			<input type="hidden" name="searchType" value="2">
			<table>
			<tr>
				<td>
			性别：
			<select name="gender">
				<option value="1" <c:if test="${gender == 1}">selected="selected"</c:if>>男生</option>
				<option value="2" <c:if test="${gender == 2}">selected="selected"</c:if>>女生</option>
			</select>
				</td>
			</tr>
			<tr>
					<td>
			年龄：
			<select name="agesmin">
				<option value="1" <c:if test="${agesmin == 1}">selected="selected"</c:if>>1</option>
				<option value="18" <c:if test="${agesmin == 18}">selected="selected"</c:if>>18</option>
				<option value="20" <c:if test="${agesmin == 20}">selected="selected"</c:if>>20</option>
				<option value="22" <c:if test="${agesmin == 22}">selected="selected"</c:if>>22</option>
				<option value="25" <c:if test="${agesmin == 25}">selected="selected"</c:if>>25</option>
				<option value="27" <c:if test="${agesmin == 27}">selected="selected"</c:if>>27</option>
				<option value="30" <c:if test="${agesmin == 30}">selected="selected"</c:if>>30</option>
				<option value="32" <c:if test="${agesmin == 32}">selected="selected"</c:if>>32</option>
				<option value="35" <c:if test="${agesmin == 35}">selected="selected"</c:if>>35</option>
				<option value="37" <c:if test="${agesmin == 37}">selected="selected"</c:if>>37</option>
				<option value="40" <c:if test="${agesmin == 40}">selected="selected"</c:if>>40</option>
				<option value="42" <c:if test="${agesmin == 42}">selected="selected"</c:if>>42</option>
				<option value="45" <c:if test="${agesmin == 45}">selected="selected"</c:if>>45</option>
				<option value="47" <c:if test="${agesmin == 47}">selected="selected"</c:if>>47</option>
				<option value="50" <c:if test="${agesmin == 50}">selected="selected"</c:if>>50</option>
				<option value="60" <c:if test="${agesmin == 60}">selected="selected"</c:if>>60</option>
				<option value="70" <c:if test="${agesmin == 70}">selected="selected"</c:if>>70</option>
				<option value="80" <c:if test="${agesmin == 80}">selected="selected"</c:if>>80</option>
				<option value="90" <c:if test="${agesmin == 90}">selected="selected"</c:if>>90</option>
			</select>
			~
			<select name="agesmax">
				<option value="18" <c:if test="${agesmin == 18}">selected="selected"</c:if>>18</option>
				<option value="20" <c:if test="${agesmin == 20}">selected="selected"</c:if>>20</option>
				<option value="22" <c:if test="${agesmin == 22}">selected="selected"</c:if>>22</option>
				<option value="25" <c:if test="${agesmin == 25}">selected="selected"</c:if>>25</option>
				<option value="27" <c:if test="${agesmin == 27}">selected="selected"</c:if>>27</option>
				<option value="30" <c:if test="${agesmin == 30}">selected="selected"</c:if>>30</option>
				<option value="32" <c:if test="${agesmin == 32}">selected="selected"</c:if>>32</option>
				<option value="35" <c:if test="${agesmin == 35}">selected="selected"</c:if>>35</option>
				<option value="37" <c:if test="${agesmin == 37}">selected="selected"</c:if>>37</option>
				<option value="40" <c:if test="${agesmin == 40}">selected="selected"</c:if>>40</option>
				<option value="42" <c:if test="${agesmin == 42}">selected="selected"</c:if>>42</option>
				<option value="45" <c:if test="${agesmin == 45}">selected="selected"</c:if>>45</option>
				<option value="47" <c:if test="${agesmin == 47}">selected="selected"</c:if>>47</option>
				<option value="50" <c:if test="${agesmin == 50}">selected="selected"</c:if>>50</option>
				<option value="60" <c:if test="${agesmin == 60}">selected="selected"</c:if>>60</option>
				<option value="70" <c:if test="${agesmin == 70}">selected="selected"</c:if>>70</option>
				<option value="80" <c:if test="${agesmin == 80}">selected="selected"</c:if>>80</option>
				<option value="90" <c:if test="${agesmin == 90}">selected="selected"</c:if>>90</option>
			</select>
				</td>
			</tr>
			<tr>
				<td>
				<input type="submit" name="搜索" value="搜索">
				</td>
			</tr>
			</table>
		</form>
	</div>
</div>

<script>
function voteTravel(userid){
	$.ajax({
		type : "POST",
		url : ctx + "/vote/vtravel.do",
		data : "voted="+userid,
		dataType:"xml", 
		timeout:20000,
		success : function(data){
			if($(data).find('result').text().toUpperCase().indexOf("TRUE") >= 0){
				var count = $(data).find('content').text();
				var divx = '#user_vote_count_' + userid;
				$(divx).html(count);
				alert('投票成功');
			}else{
				alert($(data).find('content').text());
			}
		},
		error: function(){
		}
	});
}
</script>